home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1999 #2 / Amiga Plus CD - 1999 - No. 2.iso / System-Boost / Emulatoren / warpsnes / theguis.lha / SNESLauncher.LZX / Demo.h next >
C/C++ Source or Header  |  2008-01-20  |  3KB  |  157 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*************************************************************/
  4.  
  5. /* MUI */
  6. #include <libraries/mui.h>
  7.  
  8. /* System */
  9. #include <libraries/asl.h>
  10. #include <libraries/gadtools.h>
  11. #include <dos/dos.h>
  12. #include <graphics/gfxmacros.h>
  13. #include <workbench/workbench.h>
  14.  
  15. /* Prototypes */
  16. #include <clib/alib_protos.h>
  17. #include <clib/exec_protos.h>
  18. #include <clib/dos_protos.h>
  19. #include <clib/icon_protos.h>
  20. #include <clib/graphics_protos.h>
  21. #include <clib/intuition_protos.h>
  22. #include <clib/gadtools_protos.h>
  23. #include <clib/utility_protos.h>
  24. #include <clib/asl_protos.h>
  25.  
  26. #ifndef __GNUC__
  27. #include <clib/muimaster_protos.h>
  28. #else
  29. #include <inline/muimaster.h>
  30. #endif
  31.  
  32. /* ANSI C */
  33. #include <stdlib.h>
  34. #include <string.h>
  35. #include <stdio.h>
  36.  
  37.  
  38. /* Compiler specific stuff */
  39.  
  40. #ifdef _DCC
  41.  
  42. #define REG(x) __ ## x
  43. #define ASM
  44. #define SAVEDS __geta4
  45.  
  46. #else
  47.  
  48. #define REG(x) register __ ## x
  49.  
  50. #if defined __MAXON__ || defined __GNUC__
  51. #define ASM
  52. #define SAVEDS
  53. #else
  54. #define ASM    __asm
  55. #define SAVEDS __saveds
  56. #endif /* if defined ... */
  57.  
  58.  
  59. #ifdef __SASC
  60. #include <pragmas/exec_sysbase_pragmas.h>
  61. #else
  62. #ifndef __GNUC__
  63. #include <pragmas/exec_pragmas.h>
  64. #endif /* ifndef __GNUC__ */
  65. #endif /* ifdef SASC      */
  66.  
  67. #ifndef __GNUC__
  68.  
  69. #include <pragmas/dos_pragmas.h>
  70. #include <pragmas/icon_pragmas.h>
  71. #include <pragmas/graphics_pragmas.h>
  72. #include <pragmas/intuition_pragmas.h>
  73. #include <pragmas/gadtools_pragmas.h>
  74. #include <pragmas/utility_pragmas.h>
  75. #include <pragmas/asl_pragmas.h>
  76. #include <pragmas/muimaster_pragmas.h>
  77.  
  78. #endif /* ifndef __GNUC__ */
  79.  
  80. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  81. struct Library *MUIMasterBase;
  82.  
  83. #endif /* ifdef _DCC */
  84.  
  85.  
  86. /*************************/
  87. /* Init & Fail Functions */
  88. /*************************/
  89.  
  90. static VOID fail(APTR app,char *str)
  91. {
  92.         if (app)
  93.                 MUI_DisposeObject(app);
  94.  
  95. #ifndef _DCC
  96.         if (MUIMasterBase)
  97.                 CloseLibrary(MUIMasterBase);
  98. #endif
  99.  
  100.         if (str)
  101.         {
  102.                 puts(str);
  103.                 exit(20);
  104.         }
  105.         exit(0);
  106. }
  107.  
  108.  
  109. #ifdef _DCC
  110.  
  111. int brkfunc(void) { return(0); }
  112.  
  113. int wbmain(struct WBStartup *wb_startup)
  114. {
  115.         extern int main(int argc, char *argv[]);
  116.         return (main(0, (char **)wb_startup));
  117. }
  118.  
  119. #endif
  120.  
  121.  
  122. #ifdef __SASC
  123. int CXBRK(void) { return(0); }
  124. int _CXBRK(void) { return(0); }
  125. void chkabort(void) {}
  126. #endif
  127.  
  128.  
  129. static VOID init(VOID)
  130. {
  131. #ifdef _DCC
  132.         onbreak(brkfunc);
  133. #endif
  134.  
  135. #ifndef _DCC
  136.         if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  137.                 fail(NULL,"Failed to open "MUIMASTER_NAME".");
  138. #endif
  139. }
  140.  
  141.  
  142. #ifndef __SASC
  143. static VOID stccpy(char *dest,char *source,int len)
  144. {
  145.         strncpy(dest,source,len);
  146.         dest[len-1]='\0';
  147. }
  148. #endif
  149.  
  150.  
  151. #ifndef MAKE_ID
  152. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  153. #endif
  154.  
  155.  
  156. LONG __stack = 8192;
  157.